<template>
    <yd-cell-item>
        <span slot="left"><img :src="codeUrl" alt="验证码" class="code"></span>
        <!--<span slot="left"><img v-attr="width:'100px'" alt="验证码"></span>-->
                    <span slot="right">
                        <button @click="getCode()" class="yd-btn yd-btn-hollow" :disabled="codeDis">看不清换一张</button>
                    </span>
    </yd-cell-item>
</template>
<script>
    import Config from '../../js/config.js';
    export default{
        data: function () {
            return {
                codeUrl: '',
                codeDis: false
            }
        },
        created: function () {
            this.codeUrl = Config.codeUrl + Config.JSSOSESSIONID;
        },
        methods: {
            getCode: function () {
                var _this = this;
                _this.codeDis = true;
                document.querySelector('.code').setAttribute('src', Config.codeUrl + Config.JSSOSESSIONID);
                setTimeout(function () {
                    _this.codeDis = false;
                }, 2000);
            }
        }
    }
</script>